home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / queues.exe / QCLIENT.C < prev    next >
Text File  |  1992-01-13  |  3KB  |  74 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                                                           *
  3.  *                                                                           *
  4.  Program : QCLIENT.C
  5.  Date    : 05/20/91
  6.  Function: QCLIENT submits jobs to a queue.
  7.  Genesis : Turbo C 2.0
  8.            Compiled in Turbo C environment with defaults under DOS 3.3.
  9.  
  10.  This software is provided as is and carries no warranty
  11.  whatsoever.  Novell disclaims and excludes any and all implied
  12.  warranties of merchantability, title and fitness for a particular
  13.  purpose.  Novell does not warrant that the software will satisfy
  14.  your requirements or that the software is without defect or error
  15.  or that operation of the software will be uninterrupted.  You are
  16.  using the software at your risk.  The software is not a product
  17.  of Novell, Inc. or any of subsidiaries.
  18.  *                                                                           *
  19.  *                                                                           *
  20.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  21.  
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <io.h>
  25. #include <nit.h>
  26. #include <niterror.h>
  27. #include <nitq.h>
  28.  
  29. #define INT21 0x21
  30. #define OT_TEST_SERVER   0x8010
  31. #define OT_TEST_QUEUE    0x8020
  32.  
  33. void main (void);
  34.  
  35. char writeBuf[14] = "This is a test" ;
  36. JobStruct job;
  37.  
  38. void main() {
  39.     int  cCode, NETQfileHandle, sizeWritten;
  40.     long queueID, serverID;
  41.  
  42.     if (cCode = GetBinderyObjectID ("CHRIS_QUEUE",
  43.                                     OT_TEST_QUEUE,
  44.                                     &queueID))
  45.       printf ("\nError %d getting bindery object ID.", cCode);
  46.     if (cCode = GetBinderyObjectID ("CHRIS_SERVER",
  47.                                     OT_TEST_SERVER,
  48.                                     &serverID))
  49.       printf ("\nError %d getting bindery object ID.", cCode);
  50.     job.targetServerIDNumber = serverID;
  51.     memset (job.targetExecutionTime, 0xFF, sizeof (job.targetExecutionTime));
  52.     job.jobType = 0x0045;
  53.     job.jobControlFlags = QF_AUTO_START;
  54.     if (cCode = CreateQueueJobAndFile (queueID,
  55.                                        &job,
  56.                                        &NETQfileHandle))
  57.       printf ("\nError %d creating queue job and file.", cCode);
  58.     sizeWritten = write (NETQfileHandle,
  59.                          writeBuf, sizeof (writeBuf));
  60.     if (sizeWritten != sizeof (writeBuf)) {
  61.       printf ("\nError writing data buffer.");
  62.       if (cCode = CloseFileAndAbortQueueJob (queueID,
  63.                                              job.jobNumber,
  64.                                              NETQfileHandle))
  65.         printf ("\nError %d closing and aborting queue job.", cCode);
  66.       }
  67.     else
  68.       if (cCode = CloseFileAndStartQueueJob (queueID,
  69.                                              job.jobNumber,
  70.                                              NETQfileHandle))
  71.         printf ("\nError %d closing and starting queue job.", cCode);
  72. }
  73.  
  74.